﻿using UnityEngine;

public class PlayerJumpState:PlayerStateBase
{
    public PlayerJumpState(ControllerBase controller, StateMachineBase stateMachine, string stateName,string 
        animatorParameter) 
        : base(controller, stateMachine, stateName,animatorParameter)
    {
    }

    public override void Enter()
    {
        base.Enter();
        SelfController.mRigidbody2D.AddForce(new Vector2(0, Setting.jumpForce), ForceMode2D.Impulse);
    }

    public override void Update()
    {
        base.Update();
        if (controller.GetVelocity().y < 0)
        {
            stateMachine.ChangeState(Setting.air);
            return;
        }
    }

    public override void Exit()
    {
        base.Exit();
    }
}